package com.jy.bo.common.conf.socket;

import com.alibaba.fastjson.JSONObject;
import com.fqgj.common.utils.HttpUtil;
import com.google.common.collect.Maps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * @program: binary-option
 * @description
 * @author: binary
 * @create: 2020-08-07 14:54
 **/
public class SocketMessageUtil {

    private static final Logger LOGGER = LoggerFactory.getLogger(SocketMessageUtil.class);


    public static void pushSocketMessage(SocketMessageInfo socketMessageInfo, String url) {
        try {
            String s = JSONObject.toJSONString(socketMessageInfo);
            LOGGER.info("== pushSocketMessage ==,s:{},url:{}",s,url);
            Map<String, String> header = Maps.newHashMap();
            header.put("Content-Type", "application/json");
            HttpUtil.postPageBody(url, header, s);
        } catch (Exception e) {
            LOGGER.error("============= push socket message error, e" + e);
        }
    }
}
